import request from '@/utils/request'


//从配置中获取业务的地址
import {baseUrlConfig} from '@/config/config'
import axios from "@/utils/request";
const basePath = baseUrlConfig.businessBaseUrl
const userCenterUrl = baseUrlConfig.userCenterUrl


// 获取分页列表
export const getListPage = (data: any) => {
  return request({
    url: basePath + '/secure/trainingRecords/listPage',
    method: 'post',
    data
  })
}

// 获取所有的单位
export const getUnitList = () => {
  return request({
    url: basePath + '/secure/recycleUnit/list',
    method: 'get',
  })
}

// 新增
export const addSaveTrainingRecords = (data: any) => {
  return request({
    url: basePath + '/secure/trainingRecords/save',
    method: 'post',
    data
  })
}

// 新增
export const addSubmitTrainingRecords = (data: any) => {
  return request({
    url: basePath + '/secure/trainingRecords/submit',
    method: 'post',
    data
  })
}

// 编辑
export const editTrainingRecords = (data: any) => {
  return request({
    url: basePath + '/secure/trainingRecords/edit',
    method: 'post',
    data
  })
}

// 驳回
export const rejectTrainingRecords = (data: any) => {
  return request({
    url: basePath + '/secure/trainingRecords/reject',
    method: 'post',
    data
  })
}

// 通过
export const passTrainingRecords = (data: any) => {
  return request({
    url: basePath + '/secure/trainingRecords/pass',
    method: 'post',
    data
  })
}

//删除
export const deleteTrainingRecords = (data: any) => {
  return request({
    url: basePath + "/secure/trainingRecords/delete",
    method: 'post',
    data
  })
}

//导出当前页的数据
export const exportPageList: (data: any) => Promise<[]> = (data: any) => {
  return request({
    url: basePath + '/secure/trainingRecords/export',
    method: 'post',
    responseType: 'blob',
    data
  })
}
